using System.IO;
using System.Reflection;
using log4net.Config;

namespace ComponentLoader
{
    public static class Log4Net
    {
        public static void Setup() {
            Setup(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
        }

        public static void Setup(string path) {
            var configStream = Assembly.GetCallingAssembly().GetManifestResourceStream("ComponentLoader.log4net.config");
            XmlConfigurator.Configure(configStream);

            //var configFile = new FileInfo(Path.Combine(path, @"log4net.config"));
            //if (!configFile.Exists) {
            //    throw new FileNotFoundException(string.Format(
            //        @"Die Konfigurationsdatei '{0}' konnte nicht im Verzeichnis '{1}' gefunden werden.",
            //        configFile.Name, configFile.DirectoryName));
            //}
            //XmlConfigurator.ConfigureAndWatch(configFile);
        }
    }
}